<template>
  <div class="userinfo">
    <span>login：{{ user.login }}</span>
    <span>name：{{ user.name }}</span>
    <span>twitter_username：{{ user.twitter_username }}</span>
  </div>
</template>

<script>
import { getUserInfo } from "@/api/index";
export default {
  data() {
    return {
      user: {
        login: "",
        name: "",
        twitter_username: "",
      },
      username: "lukas",
    };
  },
  created() {
    getUserInfo(this.username).then((res) => {
      const { login, name, twitter_username } = res.data;
      this.user.login = login;
      this.user.name = name;
      this.user.twitter_username = twitter_username;
    });
  },
};
</script>

<style lang="less" scoped>
.userinfo {
  font-size: 16px;

  span {
    padding: 0 10px;
  }
}
</style>